From 69b31441cf7e0b6b18a4bdb845f85958b7ad52f1 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Fri, 5 Sep 2008 19:09:24 +0000 Subject: [PATCH] gbfile: Tweak unicode check 'gbfunicode'. --- gbfile.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gbfile.c b/gbfile.c index 554c4b641..83a87dd73 100644 --- a/gbfile.c +++ b/gbfile.c @@ -938,25 +938,24 @@ gbfunicode(gbfile *file) file->unicode_checked = 1; + pos = gbftell(file); + gbfrewind(file); + c = gbfgetc(file); if (c == EOF) return 0; if ((c != 0xFE) && (c != 0xFF)) { - gbfungetc(c, file); + if (pos) gbfseek(file, pos, SEEK_SET); return 0; } - - pos = gbftell(file); - gbfrewind(file); c = c | (gbfgetc(file) << 8); if (c == 0xFEFF) file->big_endian = 0; else if (c == 0xFFFE) file->big_endian = 1; else { - gbfseek(file, pos, SEEK_SET); + if (pos) gbfseek(file, pos, SEEK_SET); return 0; } - file->unicode = 1; if (pos != 0) gbfseek(file, pos, SEEK_SET); } -- 2.30.2